<%-- 
    Document   : AdminCustomer
    Created on : Aug 6, 2012, 11:04:34 PM
    Author     : Administrator
--%>

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@taglib uri="/WEB-INF/taglib139.tld" prefix="pg" %>
<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>Management Customers</title>
        <link type="text/css" href="CSS/humanity/jquery-ui-1.8.17.custom.css" rel="stylesheet" />
        <link type="text/css" href="CSS/Style.css" rel="stylesheet" />
        <script type="text/javascript" src="js/jquery-1.7.1.min.js"></script>
        <script type="text/javascript" src="js/jquery-ui-1.8.17.custom.min.js"></script>
        <script type="text/javascript" src="js/jquery-1.6.js"></script>
        <script type="text/javascript" src="js/jquery-ui-1.8.13.custom.min.js"></script>
        <script type="text/javascript" src="js/additional-methods.js"></script>
        <script type="text/javascript" src="js/jquery.validate.js"></script>
        <script>
            $(function() {
                $("#date").datepicker({ dateFormat: 'dd/mm/yy' });
                $("#testForm").validate({
                    rules:{
                        txtNameAccount: {
                            required:true
                        },
                        txtPasswourd: {
                            required:true
                        },
                        txtFullname: {
                            required:true
                        },
                        txtDob: {
                            required:true
                        },
                        txtEmail: {
                            required:true
                        },
                        txtPhone: {
                            required:true
                        },
                        txtAddress:
                            {
                            required:true
                        }
                    }
                })
            });

        </script>

    </head>
    <body>
        <div id="main"><!-- start header -->
            <div id="header">
                <div id="logo">
                    <img style="border: none;" src="images/logo1.png" alt=""/>
                </div>
                <div id="menu">
                    <ul>
                        <li><a href="AdminAdministrator.jsp">Administrator</a></li>
                        <li><a href="AdminEvents.jsp">Events</a></li>
                        <li><a href="AdminiFeedBack.jsp">Feebacks</a></li>
                        <li><a href="AdminEventCustomer.jsp">Event Customer</a></li>
                        <li><a href="AdminStatistic.jsp">Statistic</a></li>
                        <li><a href="#">About</a></li>
                    </ul>
                </div>
                <!-- end header -->
            </div>
            <!-- start page -->
            <div id="top"></div>
            <div id="page">
                <!-- start sidebar two -->
                <div id="sidebar2" class="sidebar">
                    <jsp:include page="temp/login2.jsp" />
                </div>
                <!-- end sidebar two -->
                <!-- start content -->
                <div id="content">
                    <%
                        String user = (String) session.getAttribute("aha");
                        if (user == null) {
                            response.sendRedirect("Logout.jsp");
                        }
                    %>
                    <div class="entry">
                        <div id="header2" >Customers</div>
                        <div align="right">
                            <form action="Controllers" method="post">
                                <label style="width:90px;height:25px;font-size:18px">Search Name:&nbsp;</label><input type="text" name="txtNameAccount" style="width:170px;height:25px" />
                                <input type="submit" name="btAction" value="Search" style="width:70px;height:28px"/>

                            </form>
                        </div>
                        <br/>
                        <hr/>
                        <br/>
                        <c:if test="${not empty requestScope.Erros}">
                            <font style="color: red;font-size: 16px">${requestScope.Erros}</font>
                        </c:if>
                        <br/>
                        <table  style="width:100%">
                            <tr id="rowTable">
                                <th>Name Accounts</th>
                                <th>FullName</th>
                                <th>Gender</th>
                                <th>Date Of Birth</th>
                                <th>Phone</th>
                                <th>Email</th>
                                <th>Address</th>
                                <th></th>
                            </tr>

                            <c:if test="${empty requestScope.Search}">
                                <pg:paging pageSize="5">
                                    <jsp:useBean id="Customer" class="Models.adapterCustomers"></jsp:useBean>
                                    <c:forEach items="${Customer.allCustomers}" var="c">
                                        <pg:item>
                                            <tr id="rowTable">

                                                <th>${c.userCustomer}</th>
                                                <th>${c.fullName}</th>
                                                <th><input type="checkbox" name="chkGender" readonly="true" value="${c.gender}" <c:if test="${c.gender}">checked</c:if>></input></th>
                                                <th>${c.dob}</th>
                                                <th>${c.phoneNumber}</th>
                                                <th>${c.email}</th>
                                                <th>${c.address}</th>
                                                <c:url var="Edit" value="Controllers" >
                                                    <c:param name="txtTen" value="${c.codeCustomer}"></c:param>
                                                    <c:param name="btAction" value="EditCustomer"></c:param>
                                                </c:url>
                                                <c:url var="Delete" value="Controllers" >
                                                    <c:param name="txtTen" value="${c.codeCustomer}"></c:param>
                                                    <c:param name="btAction" value="DeleteCustomer"></c:param>
                                                </c:url>
                                                <th style="width:16%"><p>
                                                <a href="${Edit}">Edit</a> &nbsp;|&nbsp;<a href="${Delete}">Delete</a>
                                            </p></th>
                                            </tr>
                                        </pg:item>
                                    </c:forEach>

                                    <pg:index>
                                        <pg:page><%=thisPage%></pg:page>
                                        <pg:firstPage>[First]</pg:firstPage>
                                        <pg:lastPage>[Last]</pg:lastPage>
                                    </pg:index>
                                </pg:paging>
                            </c:if>

                            <c:if test="${not  empty requestScope.Search}">
                                <pg:paging pageSize="5">
                                    <c:forEach items="${requestScope.Search}" var="c">
                                        <pg:item>
                                            <tr id="rowTable">

                                                <th>${c.userCustomer}</th>
                                                <th>${c.fullName}</th>
                                                <th><input type="checkbox" name="chkGender" readonly="true" value="${c.gender}" <c:if test="${c.gender}">checked</c:if>></input></th>
                                                <th>${c.dob}</th>
                                                <th>${c.phoneNumber}</th>
                                                <th>${c.email}</th>
                                                <th>${c.address}</th>
                                                <c:url var="Edit" value="Controllers" >
                                                    <c:param name="txtTen" value="${c.codeCustomer}"></c:param>
                                                    <c:param name="btAction" value="EditCustomer"></c:param>
                                                </c:url>
                                                <c:url var="Delete" value="Controllers" >
                                                    <c:param name="txtTen" value="${c.codeCustomer}"></c:param>
                                                    <c:param name="btAction" value="DeleteCustomer"></c:param>
                                                </c:url>
                                                <th style="width:16%"><p>
                                                <a href="${Edit}">Edit</a> &nbsp;|&nbsp;<a href="${Delete}">Delete</a>
                                            </p></th>
                                            </tr>
                                        </pg:item>
                                    </c:forEach>
                                    <pg:index>
                                        <pg:page><%=thisPage%></pg:page>
                                        <pg:firstPage>[First]</pg:firstPage>
                                        <pg:lastPage>[Last]</pg:lastPage>
                                    </pg:index>
                                </pg:paging>
                            </c:if>            
                        </table>
                        <br/>
                        <br/>
                        <hr/>
                        <br/>
                        <tables   style="width: 100%">
                            <tr align="left">
                                <th><font style="font-size: 20px;color: #D55220">Management Customer</font></th>
                            </tr>
                            </table>
                            <br/>
                            <br/>
                            <hr/>
                            <br/>
                            <form action="Controllers" method="post" id="testForm">
                                <div align="left">
                                    <c:if test="${empty requestScope.EditCus}">
                                        <table style="widows:80%">
                                            <tr>
                                                <th colspan="2">
                                                    <font style="color: red">
                                                    <c:if test="${not empty requestScope.loi}">
                                                        ${requestScope.loi}
                                                    </c:if>
                                                    </font>
                                                </th>
                                            </tr>
                                            <tr>
                                                <th>Name Account</th>
                                                <th><input type="text" name="txtNameAccount"  style="width: 230px;height: 25px"/></th>
                                            </tr>
                                            <tr>
                                                <th>Password</th>
                                                <th><input type="password" name="txtPasswourd"  style="width: 230px;height: 25px"/></th>
                                            </tr>
                                            <tr>
                                                <th>Fullname</th>
                                                <th><input type="text" name="txtFullname"  style="width: 230px;height: 25px"/></th>
                                            </tr>
                                            <tr>
                                                <th>Date of Birth</th>
                                                <th><input type="text" name="txtDob"  id="date" style="width: 230px;height: 25px"/></th>
                                            </tr>
                                            <tr>
                                                <th>Gender</th>
                                                <th><input type="Checkbox" name="chkGender"  style="width: 25px;height: 25px"/></th>
                                            </tr>
                                            <tr>
                                                <th>Phone Number</th>
                                                <th><input type="text" name="txtPhone"  style="width: 230px;height: 25px"/></th>
                                            </tr>
                                            <tr>
                                                <th>Address Email</th>
                                                <th><input type="text" name="txtEmail"  style="width: 230px;height: 25px"/></th>
                                            </tr>
                                            <tr>
                                                <th>Address</th>
                                                <th><input type="text" name="txtAddress"  style="width: 230px;height: 25px"/></th>
                                            </tr>
                                            <tr>
                                                <th></th>
                                                <th>
                                                    <input type="submit" name="btAction" value="AddCustomer" style="width: 90px;height: 25px"></input>
                                                    <input type="reset" name="btAction" value="Reset" style="width: 80px;height: 25px"></input>
                                                </th>
                                            </tr>
                                        </table>

                                    </c:if>
                                    <c:if test="${not empty requestScope.EditCus}">
                                        <c:forEach items="${requestScope.EditCus}" var="c"> 
                                            <table style="widows:80%">
                                                <tr>
                                                    <th>Code Customer</th>
                                                    <th><input type="text" name="txtCode"  readonly="true" value="${c.codeCustomer}" style="width: 230px;height: 25px"/></th>
                                                </tr>
                                                <tr>
                                                    <th>Name Account</th>
                                                    <th><input type="text" name="txtNameAccount" value="${c.userCustomer}" style="width: 230px;height: 25px"/></th>
                                                </tr>
                                                <tr>
                                                    <th>Password</th>
                                                    <th><input type="password" name="txtPasswourd" value="${c.passwourds}"  style="width: 230px;height: 25px"/></th>
                                                </tr>
                                                <tr>
                                                    <th>Fullname</th>
                                                    <th><input type="text" name="txtFullname" value="${c.fullName}"  style="width: 230px;height: 25px"/></th>
                                                </tr>
                                                <tr>
                                                    <th>Date of Birth</th>
                                                    <th><input type="text" name="txtDob" value="${c.dob}" id="date"  style="width: 230px;height: 25px"/></th>
                                                </tr>
                                                <tr>
                                                    <th>Gender</th>
                                                    <th><input type="Checkbox" name="chkGender" <c:if test="${c.gender}">checked="true"</c:if>  style="width: 25px;height: 25px"/></th>
                                                    </tr>
                                                    <tr>
                                                        <th>Phone Number</th>
                                                        <th><input type="text" name="txtPhone" value="${c.phoneNumber}"  style="width: 230px;height: 25px"/></th>
                                                </tr>
                                                <tr>
                                                    <th>Address Email</th>
                                                    <th><input type="text" name="txtEmail" value="${c.email}" style="width: 230px;height: 25px"/></th>
                                                </tr>
                                                <tr>
                                                    <th>Address</th>
                                                    <th><input type="text" name="txtAddress" value="${c.address}"  style="width: 230px;height: 25px"/></th>
                                                </tr>
                                                <tr>
                                                    <th></th>
                                                    <th>
                                                        <input type="submit" name="btAction" value="UpdaterCustomer" style="width: 55px;height: 25px"></input>
                                                        <input type="reset" name="btAction" value="Reset" style="width: 60px;height: 25px"></input>
                                                    </th>
                                                </tr>
                                            </table>
                                        </c:forEach>
                                    </c:if>
                                </div>

                            </form>
                    </div>
                </div>
                <!-- end content -->

                <div style="clear: both;">&nbsp;</div>

            </div>
            <div id="bottom"></div>
            <!-- end page -->
            <!-- start footer -->
            <div id="footer">
                <p>Copyright ; 2012. <a href="#">Group</a> | <a href="#">Blue_Pumpkin </a> | <a href="" title=""><abbr title="Language">JSP and Servlet</abbr></a> | <a href="" title=""><abbr title="">CSS</abbr></a></p>
                <p>Design by <!-- Do not Remove -->
                    <a href="" title="FPT - Aptech"></a>
                    <!--End of notice -->
                </p>
            </div>
        </div>
        <!-- end footer -->
    </body>
</html>
